When bootloader_args = ['foo', 'bar'], then info->u.pv.bootloader_args =
foo\0
bar\0
\0
Before this patch, 'p++' points to the next character of 'foo\0' and never
comes to 'bar\0' (because of the '\0' in 'foo\0'), so the args will be:
args[0] = 'oo\0'
args[1] = 'o\0'
After this patch, 'p++' points to the next string of pv.bootloader_args, so we
get the correct args:
args[0] = 'foo\0'
args[1] = 'bar\0'
Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
flexarray_set(args, nr++, libxl__sprintf(gc, "--output-directory=%s", "/var/run/libxl/"));
if (info->u.pv.bootloader_args) {
- char *p = info->u.pv.bootloader_args[0];
- while (*(p++))
- flexarray_set(args, nr++, p);
+ char **p = info->u.pv.bootloader_args;
+ while (*p) {
+ flexarray_set(args, nr++, *p);
+ p++;
+ }
}
flexarray_set(args, nr++, disk);